First I'd like to mention that I am currently using LibraryLink, and that LibraryFunctions can be shared with parallel kernels with DistributeDefinitions. When using Parallelize, this happens automatically. (I'm assuming that you have local parallel kernels. For remote ones, see here.)
For MathLink programs, this will not work. Let's try it:
First, let's launch the kernels:
In[6]:= LaunchKernels[]
Then install the addtwo example into the main kernel:
In[7]:= SetDirectory[$InstallationDirectory <>
"/SystemFiles/Links/MathLink/DeveloperKit/" <> $SystemID <>
"/PrebuiltExamples/"];
In[8]:= link = Install["addtwo"]
Out[8]= LinkObject["addtwo", 23, 11]
It will not work in parallel kernels even after distribution the definitions because the connection exists only between addtwo and the main kernel:
In[9]:= DistributeDefinitions[AddTwo]
Out[9]= AddTwo
In[10]:= ParallelEvaluate[Print@AddTwo[2, 2]]
(kernel 2) LinkObject::linkn: Argument LinkObject[addtwo,23,11] in LinkWrite[LinkObject[addtwo,23,11],CallPacket[0,{2,2}]] has an invalid LinkObject number; the link may be closed.
(kernel 1) LinkObject::linkn: Argument LinkObject[addtwo,23,11] in LinkWrite[LinkObject[addtwo,23,11],CallPacket[0,{2,2}]] has an invalid LinkObject number; the link may be closed.
(kernel 2) $Failed
(kernel 1) $Failed
Out[10]= {Null, Null}
Now lets install it into each parallel kernel:
In[11]:= ParallelEvaluate[Install["addtwo"]]
Out[11]= {LinkObject["addtwo", 6, 6], LinkObject["addtwo", 6, 6]}
In[12]:= ParallelEvaluate[Print@AddTwo[2, 2]]
(kernel 1) 4
(kernel 2) 4
Out[12]= {Null, Null}
As you can see, now it works in each of them, but the addtwo process will also exist in three copies (on a two-core machine). Note: you will have to run ParallelNeeds[] if you load any packages required by the sub kernels.
I must note that unlike with LibraryLink, I have no practical experience with this.
Caveat: This problem didn't come up in my tests, but I think it may be possible that the symbol AddTwo will get auto-synchronized between the kernels, so they might lose the connection to their own addtwo process. This could be avoided by placing the AddTwo symbol into a different context than Global ` (see here and here), but unfortunately you won't have control over this unless you are writing your MathLink programs yourself.